package com.ruoyi.system.enums;

import lombok.Getter;

import java.util.ArrayList;
import java.util.List;

/**
 * 进度状态枚举
 */
@Getter
public enum ProgressStatusEnum {

    /**
     * 项目状态枚举
     */
    PROJECT_VISIT("上门", "VISIT", "#1890FF"),
    PROJECT_MEASURE("量房", "MEASURE", "#52C41A"),
    PROJECT_DESIGN("设计", "DESIGN", "#722ED1"),
    PROJECT_QUOTE("报价", "QUOTE", "#FA8C16"),
    PROJECT_CONTRACT("合同", "CONTRACT", "#13C2C2"),
    PROJECT_CONSTRUCTION("施工", "CONSTRUCTION", "#EB2F96"),
    PROJECT_COMPLETION("完工", "COMPLETION", "#52C41A"),
    PROJECT_SETTLEMENT("结单", "SETTLEMENT", "#F5222D");

    /**
     * 设计状态枚举
     */
    public enum DesignStatus {
        NOT_START("排期中", "NOT_START", "#999999"),
        DESIGNING("设计中", "DESIGNING", "#1890FF"),
        FIRST_DELIVERY("一稿交付", "FIRST_DELIVERY", "#FF7D00"),
        SECOND_DELIVERY("二稿交付", "SECOND_DELIVERY", "#FFAA00"),
        COMPLETED("完成", "COMPLETED", "#00B42A"),
        PAUSED("暂停", "PAUSED", "#FF4D4F");
        
        private final String label;
        private final String value;
        private final String color;
        
        DesignStatus(String label, String value, String color) {
            this.label = label;
            this.value = value;
            this.color = color;
        }
        
        public String getLabel() { return label; }
        public String getValue() { return value; }
        public String getColor() { return color; }
    }

    /**
     * 施工状态枚举
     */
    public enum ConstructionStatus {
        NOT_STARTED("未开始", "NOT_STARTED", "#999999"),
        IN_PROGRESS("进行中", "IN_PROGRESS", "#1890FF"),
        PAUSED("暂停", "PAUSED", "#FF4D4F"),
        COMPLETED("已完成", "COMPLETED", "#52C41A");
        
        private final String label;
        private final String value;
        private final String color;
        
        ConstructionStatus(String label, String value, String color) {
            this.label = label;
            this.value = value;
            this.color = color;
        }
        
        public String getLabel() { return label; }
        public String getValue() { return value; }
        public String getColor() { return color; }
    }

    private final String label;
    private final String value;
    private final String color;

    ProgressStatusEnum(String label, String value, String color) {
        this.label = label;
        this.value = value;
        this.color = color;
    }

    /**
     * 根据值获取枚举
     */
    public static ProgressStatusEnum getByValue(String value) {
        for (ProgressStatusEnum status : values()) {
            if (status.value.equals(value)) {
                return status;
            }
        }
        return null;
    }

    /**
     * 获取所有项目状态列表
     */
    public static List<StatusVO> getAllProjectStatus() {
        List<StatusVO> list = new ArrayList<>();
        for (ProgressStatusEnum status : values()) {
            list.add(new StatusVO(status.value, status.label, status.color));
        }
        return list;
    }

    /**
     * 获取所有设计状态列表
     */
    public static List<StatusVO> getAllDesignStatus() {
        List<StatusVO> list = new ArrayList<>();
        for (DesignStatus status : DesignStatus.values()) {
            list.add(new StatusVO(status.getValue(), status.getLabel(), status.getColor()));
        }
        return list;
    }

    /**
     * 获取所有施工状态列表
     */
    public static List<StatusVO> getAllConstructionStatus() {
        List<StatusVO> list = new ArrayList<>();
        for (ConstructionStatus status : ConstructionStatus.values()) {
            list.add(new StatusVO(status.getValue(), status.getLabel(), status.getColor()));
        }
        return list;
    }

    /**
     * 状态VO类
     */
    public static class StatusVO {
        private String value;
        private String label;
        private String color;

        public StatusVO(String value, String label, String color) {
            this.value = value;
            this.label = label;
            this.color = color;
        }

        public String getValue() { return value; }
        public void setValue(String value) { this.value = value; }
        public String getLabel() { return label; }
        public void setLabel(String label) { this.label = label; }
        public String getColor() { return color; }
        public void setColor(String color) { this.color = color; }
    }
}
